package LeetCode.leetcode78;

import java.util.ArrayList;
import java.util.List;

public class Review1 {
    public List<List<Integer>> subsets(int[] nums) {
        List<List<Integer>> ans = new ArrayList<>();
        backTracking(new ArrayList<>(), ans, nums, 0);
        return ans;
    }
    public void backTracking(List<Integer> path,List<List<Integer>> res,int[] nums, int i){
        //添加res
        res.add(new ArrayList<>(path));
        for (int j = i; j < nums.length; j++) {
            path.add(nums[j]);
            backTracking(path,res,nums, j + 1);
            path.remove(path.size()-1);
        }
    }
}
